#ifndef BFCP_MESSAGE_IF_HXX
#define BFCP_MESSAGE_IF_HXX

#include "rutil/Data.hxx"
#include <iosfwd>
#include "rutil/resipfaststreams.hxx"

namespace bfcp
{
    class BfcpMessageIf
    {
    public:
        BfcpMessageIf(){}
        virtual ~BfcpMessageIf() {}

        /// facet for brief output to streams
        class Brief
        {
        public:
            Brief(const BfcpMessageIf& src);
            const BfcpMessageIf& mSource;
        };

        /// return a facet for brief encoding of message
        Brief brief() const;
        virtual BfcpMessageIf* clone() const = 0;
        /// output the entire message to stream
        virtual EncodeStream& encode(EncodeStream& strm) const = 0;
        /// output a brief description to stream
        virtual EncodeStream& encodeBrief(EncodeStream& str) const = 0;
    };

//always need std streams where things are encoded to cout, cerr, MD5Stream, etc...
#ifndef  RESIP_USE_STL_STREAMS
    EncodeStream&
        operator<<(EncodeStream& strm, const BfcpMessageIf& msg);

    EncodeStream&
        operator<<(EncodeStream& strm, const BfcpMessageIf::Brief& brief);
#endif

    std::ostream&
        operator<<(std::ostream& strm, const BfcpMessageIf& msg);

    std::ostream&
        operator<<(std::ostream& strm, const BfcpMessageIf::Brief& brief);
}

#endif //#ifndef BFCP_MESSAGE_IF_HXX
